#pragma once

#include "libs/easysql.h"
#include "config.hpp"

namespace pharmacy_server
{
    class database
    {
    public:
        static easymysql::connection& instance()
        {
            static database inst;
            return inst._conn;
        }

    private:
        database()
            : _conn(config::instance().sql_host(),
                config::instance().sql_user(),
                config::instance().sql_passwd(),
                config::instance().sql_dbname(),
                config::instance().sql_port())
        {
        }

        database(const database&) = delete;
        database& operator=(const database&) = delete;

    private:
        easymysql::connection _conn;
    };

}
